New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added delete_tileset
manage command and tileset
API route
#79
Conversation
I added a management command and API route to modify a tileset's properties by Here is an example management command:
And here is an example API call:
|
This is great! Thanks Alex. A few things before merging:
Thanks! |
@@ -492,6 +494,95 @@ def tiles(request): | |||
) | |||
|
|||
return JsonResponse(tiles_to_return, safe=False) | |||
|
|||
|
|||
@api_view(['POST', 'DELETE']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you check if the curl -X 'DELETE' server:port/api/v1/tilesets/[uuid]/
endpoint already exists? There's already a tilesets viewset that should provide, GET, POST, UPDATE, DELETE endpoints here:
higlass-server/tilesets/views.py
Line 683 in dc4d380
class TilesetsViewSet(viewsets.ModelViewSet): |
I know the POST endpoint works because I've been using it to upload datasets to higlass.io. Take a look here: http://docs-dev.higlass.io/data_preparation.html#importing-into-higlass
If possible, I'd prefer to avoid duplicating API endpoints.
@@ -55,6 +55,34 @@ curl http://localhost:8000/api/v1/tileset_info/?d=hitile-demo | |||
curl http://localhost:8000/api/v1/tiles/?d=hitile-demo.0.0.0 | |||
``` | |||
|
|||
## Preparing files for ingest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All of the datatype specific documentation is in the main documentation repository: http://docs-dev.higlass.io/data_preparation.html
The code for that can be found here: https://github.com/higlass/higlass/tree/develop/docs
@@ -1,8 +1,8 @@ | |||
Cython==0.25.2 | |||
-e git+https://github.com/mirnylab/cooler.git@master#egg=cooler |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's in the master branch that isn't in v0.7.10?
Sorry. I'm going to close this PR and start over. |
No, it's my fault that we don't have better documentation about the API endpoints. Ideally the docs would have a section on the REST API. Without looking at the code it's nearly impossible to figure out what endpoints exist and how to access them. All this is to say, your PR is really appreciated and hopefully it's not too much work to fit it into TilesetViewSet. |
I neglected to sync my fork with upstream, so starting over was necessary, anyway. Looks like the built-in DELETE does remove the database entry, but it does not remove the tileset file from the media/uploads directory. I'll look at overriding the behavior of the |
Here is a demonstration tileset:
Here is an example showing the use of the
manage.py delete_tileset
command to remove this tileset file and database record:The API call uses the
DELETE
method and theIsAuthenticated
permission class decorator, which requires authentication. Here is an example of an (unauthenticated) API call:The API returns 40x errors if the underlying instance or file is not found or cannot be removed.
For debugging purposes, I modified the
Tileset
model__str__
function to return the tileset'suuid
along with itsname
andfiletype
properties.